package cz.muni.fi.pa165.sme.client.converters;

import cz.muni.fi.pa165.sme.client.fo.SportActivityFO;
import cz.muni.fi.pa165.sportmanager.sportactivityws.SportActivity;
import org.springframework.core.convert.converter.Converter;

/**
 * @author jirankova
 */
public class SportActivity2SportActivityFOConverter implements Converter<SportActivity, SportActivityFO> {
	@Override
	public SportActivityFO convert(final SportActivity source) {
		if(source == null) {
			return null;
		}

		final SportActivityFO activityFO = new SportActivityFO();

		activityFO.setId(Long.valueOf(source.getId()));
		activityFO.setSpeed(Float.valueOf(source.getSpeed()));
		activityFO.setTitle(source.getTitle());

		return activityFO;
	}
}
